﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Default.Master" Inherits="System.Web.Mvc.ViewPage<WebStickyNotes.Models.EditTaskPersonModel>" %>
<%@ Import Namespace="WebStickyNotes.Resources" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	<%= Labels.PageTitleEditPerson %>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm()) {%>
        <fieldset>
            <legend><%= Labels.PageTitleEditPerson %></legend>
            <% Html.RenderPartial("Message", Model.Message); %>
            <%= Html.HiddenFor(model => model.Person.Id) %>
            <p>
                <label><%= Labels.FirstName %><br>
                <%= Html.TextBoxFor(model => model.Person.FirstName, new { style = "width: 20em;" }) %></label>
                <%= Html.ValidationMessageFor(model => model.Person.FirstName) %>
            </p>
            <p>
                <label><%= Labels.LastName %><br>
                <%= Html.TextBoxFor(model => model.Person.LastName, new { style = "width: 20em;" }) %></label>
                <%= Html.ValidationMessageFor(model => model.Person.LastName) %>
            </p>
            <p>
                <label><%= Labels.Email %><br>
                <%= Html.TextBoxFor(model => model.Person.Email, new { style = "width: 20em;" }) %></label>
                <%= Html.ValidationMessageFor(model => model.Person.Email) %>
            </p>
            <p>
                <label><%= Labels.Password %><br>
                <%= Html.TextBoxFor(model => model.Person.Password, new { style = "width: 20em;" }) %></label>
                <%= Html.ValidationMessageFor(model => model.Person.Password) %>
            </p>
            <p>
                <label><%= Labels.Role %><br>
                <%= Html.DropDownListFor(model => model.Person.TaskRoleId, new SelectList(Model.TaskRoles, "Id", "Title", Model.Person.TaskRoleId)) %></label>
                <%= Html.ValidationMessageFor(model => model.Person.TaskRoleId) %>
            </p>
            <p>
                <label><%= Labels.Projects %><br>
                <select name="SelectedProjects" multiple="multiple" size="5">
                    <% foreach (var project in Model.TaskProjects) { %>
                    <% int projectId = project.Id; %>
                    <% string selected = Model.SelectedProjects.Count(p => p.Equals(projectId)) > 0 ? " selected=\"true\"" : ""; %>
                    <option value="<%= project.Id %>"<%= selected %>><%= project.Title %></option>
                    <% }%>
                </select></label>
                <%= Html.ValidationMessageFor(model => model.SelectedProjects) %>
            </p>
            <p>
                <input type="submit" value="Save" />
            </p>
        </fieldset>
    <% } %>
</asp:Content>

<asp:Content ID="Content3" ContentPlaceHolderID="ScriptContent" runat="server">
</asp:Content>

